let vm = new Vue({
    el: "header",
    data: {
        user: {}
    },
    created: function () {
        //发请求获取当前登录的用户对象
        axios.get("/check").then(function (response) {
            if (response.data == "") {//代表未登录
                alert("请先登录!");
                location.href = "/login.html";
            } else {
                //服务器返回的是当前登录的用户对象
                vm.user = response.data;
            }
        })
    }
})
